package com.cn.service.server.bc.Impl;


import com.cn.bean.pojo.bc.*;
import com.cn.bean.vo.bc.UserDepartmentVo;
import com.cn.mapper.dao.db1.bc.MaterialDao;
import com.cn.service.server.bc.MaterialServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class MaterialServerImpl implements MaterialServer {
    private final MaterialDao materialDao;

    @Autowired(required=false)
    public MaterialServerImpl(MaterialDao materialDao) {
        this.materialDao = materialDao;
    }


    @Override
    public List<Material> selectMaterial(int limit, int page, String cpyt, String fabh) {
        List<Material> materials = materialDao.selectMaterial(limit, page, cpyt, fabh);
        return materials;
    }

    @Override
    public List<Material> selectMaterial1(int limit, int page, String cpyt, String fabh) {
        List<Material> materials = materialDao.selectMaterial1(limit, page, cpyt, fabh);
        return materials;
    }

    @Override
    public List<User> selectUser(String userName) {
        List<User> user = materialDao.selectUser(userName);
        return user;
    }

    @Override
    public List<Department> selectDepartment(int id) {
        List<Department> department = materialDao.selectDepartment(id);
        return department;
    }

    @Override
    public List<Material> selectMaterialFamc(String famc) {
        List<Material> materials = materialDao.selectMaterialFamc(famc);
        return materials;
    }

    @Override
    public List<MaterialList> selectMaterialList(int id) {
        List<MaterialList> materialLists = materialDao.selectMaterialList(id);
        return materialLists;
    }

    @Override
    public List<Material> selectMat(String fabh) {
        List<Material> materials = materialDao.selectMat(fabh);
        return materials;
    }

    @Override
    public List<UseDefinition> selectUseDefinition(int limit, int page, String ytbm, String ytfl, String ytmc) {
        List<UseDefinition> useDefinitions = materialDao.selectUseDefinition(limit, page, ytbm, ytfl, ytmc);
        return useDefinitions;
    }

    @Override
    public List<MaterList> selectMater(int limit, int page, String ytbm, String ytfl, String ytmc) {
        List<MaterList> materLists = materialDao.selectMater(limit, page, ytbm, ytfl, ytmc);
        return materLists;
    }
    @Override
    public List<MaterList> selectMaterA(int limit, int page, String ytbm, String ytfl, String ytmc) {
        List<MaterList> materLists = materialDao.selectMaterA(limit, page, ytbm, ytfl, ytmc);
        return materLists;
    }
    @Override
    public int updateMaterial(String cslx, String cpyt, String kh, String cz, BigDecimal hd, BigDecimal kd, String csfs, String dwjs, String bz, String xgr, String xgbm, String fabh, String famc, String xgsj) {
        return materialDao.updateMaterial(cslx,cpyt,kh,cz,hd,kd,csfs,dwjs,bz,xgr,xgbm,fabh,famc,xgsj);
    }

    @Override
    public List<UserDepartmentVo> getYwy(int limit, int page) {
        List<UserDepartmentVo> ywy = materialDao.getYwy(limit, page);
        return ywy;
    }

    @Override
    public List<User> getUser(int limit, int page, String username, String name) {
        return materialDao.getUser(limit,page,username,name);
    }


    @Override
    public int getMaterial() {
        int material = materialDao.getMaterial();
        return material;
    }

    @Override
    public int addMaterialList(int id, String wlbm, String wlmc, String wlgg, String jldw, BigDecimal bzsl, BigDecimal bzdj, BigDecimal bzje, String bzList, String csfs, String dwjs, int parentBh) {
        int i = materialDao.addMaterialList(id, wlbm, wlmc, wlgg, jldw, bzsl, bzdj, bzje, bzList, csfs, dwjs, parentBh);
        return i;
    }

    @Override
    public int getMaterialList() {
        int materialList = materialDao.getMaterialList();
        return materialList;
    }

    @Override
    public int addMaterial(int id, String fabh, String djrq, int djzt, String cslx, String cpyt, String kh, String cz, BigDecimal hd, BigDecimal kd, String csfs, String dwjs, String ywy, String ywygh, String ywbm, String ywbmgh, String bz, String zdr, String zdbm, String zdsj, String shr, String shsj, String xgr, String xgbm,String famc,String sszz) {
        int i = materialDao.addMaterial(id, fabh, djrq, djzt, cslx, cpyt, kh, cz, hd, kd, csfs, dwjs, ywy, ywygh, ywbm, ywbmgh, bz, zdr, zdbm, zdsj, shr, shsj, xgr, xgbm,famc,sszz);
        return i;
    }

    @Override
    public Material selectDjzt(int id) {
        Material material = materialDao.selectDjzt(id);

        return material;
    }

    @Override
    public int deleteMaterial(int id) {
        int i = materialDao.deleteMaterial(id);
        return i;
    }

    @Override
    public int deleteMaterialList(int id) {
        int i = materialDao.deleteMaterialList(id);
        return i;
    }

    @Override
    public int intupDateAuto0(int id, String shr, String shbm, String shsj) {
        return materialDao.intupDateAuto0(id,shr,shbm,shsj);
    }

    @Override
    public int intupDateAuto1(int id, String shr, String shbm, String shsj) {
        return materialDao.intupDateAuto1(id,shr,shbm,shsj);
    }
}
